<template>
  <div class="app-container">
    <DetailPage
      :model-name="modelName"
      :child-field-name="childFieldName"
      @action="handleAction"
    />

    <el-dialog title="title" :visible.sync="dialogFormVisible" width="600px">
      {{ action_data.invoice_line_ids__objects }}
      <el-form
        ref="dataForm"
        :rules="rules"
        :model="action_data"
        label-position="left"
      >
        <el-form-item label="活动名称">
          <el-input v-model="action_data.name" />
        </el-form-item>
        <el-form-item label="客户">
          <el-input v-model="action_data.partner_id" />
        </el-form-item>

        <div
          v-for="line in action_data.invoice_line_ids__objects"
          :key="line.id"
        >
          {{ line.id }}
          {{ line }}
          <el-form-item label="产品">
            <el-input v-model="line.product_id" />
          </el-form-item>
          <el-form-item label="产品">
            <el-input v-model="line.product_id" />
          </el-form-item>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="submit">
          确认
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import DetailPage from '@/selfComponents/DetailPage'

const modelName = 'Test/PurchaseOrderDetail'
const childFieldName = ['order_line']

export default {
  name: 'Home',
  components: { DetailPage },
  directives: {},
  filters: {},

  data() {
    return {
      modelName: modelName,
      childFieldName: childFieldName,

      dialogFormVisible: false,
      action_data: {},
      rules: {}
    }
  },

  computed: {},

  async created() {},

  methods: {
    submit() {
      //
    },
    handleAction(params) {
      const { detailData, action, action_data } = params
      console.log('xxxxxx, action,', detailData, action, action_data)
      this.action_data = action_data

      this.dialogFormVisible = true
      //
    }
  }
}
</script>
